{
// three dimensional checker board
int $x;
int $modX;
int $y;
int $modY;
int $z;
int $modZ;
for ($x = 0; $x < 10; $x++)
{
$modX = $x % 2;
for ($y = 0; $y < 10; $y++)
{
// if x is even, invert y
if ($modX)
{
$modY = $y % 2;
}else{
$modY = 1 - ($y % 2);
}
for ($z = 0; $z < 10; $z++)
{
$modZ = $z % 2;
// place a cube on the odds
if ($modY && $modZ)
{
polyCube;
move $x $y $z;
}
// place a cube on the evens
if (!$modY && !$modZ)
{
polyCube;
move $x $y $z;
}
}
}
}
}
|
|